package org.kmfdm.horrorscope.core.dao.hibernate;

import java.util.List;


import org.hibernate.criterion.Restrictions;
import org.kmfdm.horrorscope.core.dao.CustomerDAO;
import org.kmfdm.horrorscope.metamodel.Customer;
import org.springframework.transaction.annotation.Transactional;

public class CustomerDAOHibernate extends GenericDAOHibernate<Customer, Long> implements CustomerDAO {

	public Class<Customer> getPersistentClass(){
		return Customer.class;
	}
	
	@Transactional

	public List<Customer> findByName(String customerName){
		return search( Restrictions.eq("name", customerName));
		
		
	}
	@Transactional
	public void createCustomer(Customer c){
		
		saveOrUpdate(c);
		
	}
	
}
